﻿using System;
using System.Text;
using GeneralDFS.Common;
using ProtoBuf;

namespace GeneralDFS.DataEntity.Config
{
    [ProtoContract]
    [Serializable]
    public class DataNodeConfig
    {
        /// <summary>
        /// 获取唯一标识符
        /// </summary>
        public UInt64 ID { get { return DFSUtils.GetHash(Ip + ":" + RpcPort); } }

        [ProtoMember(1,IsRequired = true)]
        public int Index { get; set; }

        [ProtoMember(2, IsRequired = true)]
        public string Ip { get; set; }

        [ProtoMember(3, IsRequired = true)]
        public int RpcPort { get; set; }

        [ProtoMember(4, IsRequired = true)]
        public string ServerName{ get; set; }

        [ProtoMember(5, IsRequired = true)]
        public string Type{ get; set; }

        [ProtoMember(6, IsRequired = true)]
        public string DataNodeDirectory { get; set; }

        [ProtoMember(6, IsRequired = true)]
        public int TcpPort { get; set; }

        [ProtoMember(7, IsRequired = true)]
        public int AgentRpcPort { get; set; }
    }
}